<template>
  <div class="r">
    表格拖动
    <el-table :data="tableData" border width="100%" row-key="id" v-tablerowdrag="tableData">
      <el-table-column width="60px" label="序号" type="index"> </el-table-column>
      <el-table-column width="60px" label="姓名" prop="name"> </el-table-column>
      <el-table-column width="60px" label="年纪" prop="age"> </el-table-column>
    </el-table>
    <el-button @click="push">增加一行数据</el-button>
  </div>
</template>

<script>
export default {
  name: 'r',
  components: {},
  props: {},
  data() {
    return {
      tableData: [
        {
          id: 1,
          name: '张三',
          age: 10,
        },
        {
          id: 2,
          name: '王服',
          age: 120,
        },
        {
          id: 3,
          name: '荷叶',
          age: 102,
        },
        {
          id: 4,
          name: '跳水',
          age: 150,
        },
      ],
    };
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  methods: {
    push() {
      this.tableData.push({
        id: this.tableData.length + 1,
        name: '拖动',
        age: 150 + this.tableData.length + 1,
      });
    },
  },
};
</script>

<style scoped lang="scss">
</style>
